FormatVB Ver. 0.4 August, 1999 A program to reformat Visual Basic Source Code. This program is a Win32 Console Application. That means that it runs from the Command Line in the MS-DOS Window. It also means that is has no Install procedure, no Uninstall procedure and does not alter the Registry in any manner. Simply Unzip the Zip file into a directory on your Path and execute the program. If you decide to remove it from your computer, simple delete it from the disk. The objective of the Console Version of this program was to produce a program that is very fast, compact and simple for programmers to use and which can reformat large amounts of source code with one command in only a few minutes. In addition, it is also powerful in its reformatting capabilities. For example, it will reformat a single line Header for a Function or Sub into multiple lines. It will remove extra blank lines between functions and will insert blank lines at strategic locations. It will separate "For " and "With " groups, of specified size, by inserting a blank line before and after the groups. The best way to appreciate what the program can do is to process some very poorly formatted Visual Basic code and with the code and then examine the output. This version of the program does not overwrite the input source file. The command line requires two parameters. The first is the name of the source file and the second is the output file. A future version will effectively reformat in place and will also have generic filename capabilities. The program will then reformat all the BAS files, CLS files and FRM files in a directory with one command. To execute the program, open a MS-DOS Window and at the command line type: FormatVB inputFileName outFileName [options] See the following reference page for the options. To get started, you can try the /a option. This option invokes all the functionality of the program. So you would have: FormatVB InputFilename OutputFilename /a The source code that is feed to this program must be synthetically correct since there is no syntax checking within the program. Please process only code that has been successfully compiled within Visual Basic. Protecting a Block of Code: A block of code may be protected from reformatting by a pair of comments. At the point where the protection is desired, enter a comment with the character string "$Protect" anywhere in the comment. Then to return to formatting, enter a comment containing the character string "$Unprotect". These keywords are not case sensitive; "$Protect" and "$PROTECT" are the same. For example, '-- $Protect As of 08-20-1999 Code to be protected '-- $Unprotect Two major advantages of the program is to enforce a consistent and very readable format for source code that is developed inhouse. This reduces the cost of software maintenance very significantly. Another major advantage is realized when you have to deal with code that is developed by others; weather it be the source code that is supplied with many of programming books, a purchased application or a sample application such as the Duwamish Books that is available from Microsoft. Please note that this is Version number 0.4 of the program and treat it accordingly. Don't bet the farm -- or even a bushel of corn on it. Please make a backup copy of all source code to be processed before using the program. Then, don't overlay any source code with the reformatted source code until the reformatted source code is loaded into the Visual Basic IDE and successfully compiled. Included in the Zip file is a Sample.bas file. This is just a sample input file. Take a look at this file with Notepad, Wordpad, or some similar program, run it through the FormatVB program and then take a look at the Output that is produced. This will give you a good idea of what the program does. To process the sample input file, simply type: FormatVB Sample.bas Z1 at the DOS Prompt. Delete Z1 when you are finished. Note that there is no checking for overwriting of the output file. Don't use a filename that is already in use unless you want to replace it. This program is not shareware. This program is not freeware. However, unregistered copies of the program may be freely shared with others. Registered versions will be given functionality and features that does not currently exist and registered copies of the program may not be distributed. It is anticipated that the registration fee will be $20.00 for individuals and $50.00 for companies and corporations. The first 100 persons that provide useful feedback will be given registered copies at no cost. I am very much interested in constructive feedback. What do you like about the program? What do you dislike about it? If you run into any snags, I would appreciate receiving a snippet that demonstrates the problem; along with a brief description of the problem. Please contact me via email at: tn1@BellSouth.net Thank you, Jim Holloman FormatVB Reference Page for Options Extended Formatting Options: These options provide for formatting beyond the basic formatting. First of all, the /a option invokes all the extended formatting options. If you wish to use all the formatting features, but still specify your own tab size or ForWith group size you can do so by combinning the /t and /f options with the /a option. If a tabsize is not specified with the /t option, then the default tab size of 3 will be used. If a ForWith group size is not specified with the /f option, then the default of 6 for the "For " and "With " group size will be used. It is generally recommended that the /a option be used to invoke all the extended formatting options unless there is some specific reason why all the options are not desired. /a - Invoke all the extended formatting options. /c - Process Comments This option convents a stand-alone comment of form: 'This is a comment to '-- This is a comment /Fnn - Group size in regards to "For " and "With " groups. "For " and "With " groups, when they are larger than nn lines, will be separated from adjacent code with blank lines. The default for 'nn' is 6. This option will put a blank line before and after a "With " block or a "For " block that contains more than the specified number of lines. However, if the block is immediately proceeded by a comment, then a blank line will not be inserted before the block. /H - Process Block Headers This option will cause Block Headers (Public Function, Private Sub, etc.) that exceed 72 characters in length and have more than one parameter to be split into multiple lines. /I - Split single line "If " into two lines This option will cause single line "If " statements of the format: If a = b then c = d to be converted to two lines of the format: If a = b then _ c = d /Tn - Tab Size Setting, i.e. /t4 This option specifies the tab size, if something other than the default of 3 is desired. /W - Process WinAPI Declares This option will cause WinAPI Declares that have multiple parameters to be split into multiple lines.